
 // const http = require('../utils/request.js')
// const http = uni.$u.http
// post请求，获取菜单

/**
 *  获取token/login-biz/v1/login/refreshToken
 * @param {string}  data 获取游客token
 */
export const getToken =()=>{
	
  return  new Promise ((resolve, reject)=>{
	  uni.$u.http.post('/login-biz/v1/login',{
	  loginType:'tourists',
	  sysCode:102,
	  appId:'',
	  code:''
  }).then(res=>{
		
		uni.setStorageSync('token',res.token)
		resolve()
	})

})
}
/**
 *  获取token
 * @param {string}  data 刷新token
 */
export const getNewToken =()=>{
	
  return  new Promise ((resolve, reject)=>{
	  uni.$u.http.get('/login-biz/v1/login/refreshToken',{
	 
  }).then(res=>{
		uni.setStorageSync('userInfo',res)
		uni.setStorageSync('token',res.token)
		resolve()
	})

})
}

/**
 *  
 * @param {string} data 用户登录
 */
export const wxLogin=(data)=>{
	return	uni.$u.http.post('/login-biz/v1/login',{
		 ...data
	})
	
}
/**
 *  
 * @param {string} data 用户绑定手机号
 */
export const getBindPhoneApi=(data)=>{
	return	uni.$u.http.get('/login-biz/v1/login/bindPhone?phone='+data.phone+'&code='+data.code,{
		 ...data
	})
	
}
/**
 *  
 * @param {string} data 用户绑定手机号验证码
 */
export const getBindPhoneCodeApi=(data)=>{
	return	uni.$u.http.get('/login-biz/v1/send/bindPhoneVerificationCode?phone='+data.phone,{
		 ...data
	})
	
}
/**
 *  
 * @param {string} data 用户报名
 */
export const getCompetititonsignUpApi=(data)=>{
	return	uni.$u.http.post('/capi-biz/yisai/competition/signUp',{
		 ...data
	})
	
}
///
/**
 *  
 * @param {string} data 用户报名2
 */
export const getCompetititonsignUpJoinTypeV2Api=(data)=>{
	return	uni.$u.http.post('/capi-biz/yisai/competition/signUpJoinTypeV2',{
		 ...data
	})
	
}

/**
 *  赛事申请
 * @param {}  
 */
export const getCompetititonApplyApi=(data)=>{
	return	uni.$u.http.post('/capi-biz/yisai/competition/apply',{
		 ...data
	})
	
}
/**
 *  赛事列表
 * @param {}  
 */
export const getCompetititonListApi=(data)=>{
	return	uni.$u.http.post('/capi-biz/yisai/competition/list',{
		 ...data
	})
	
}
/**
 *  赛事类型
 * @param {}  
 */
export const getCompetititonTypeApi=(data)=>{
	return	uni.$u.http.get('/capi-biz/yisai/competition/type',{
		 ...data
	})
	
}
/**
 *  用户所属赛事列表
 * @param {}  
 */
export const getUserCompetititonListApi=(data)=>{
	return	uni.$u.http.post('/frontend-biz/yisai/user/competition/list',{
		 ...data
	})
	
}
/**
 *  赛事详情
 * @param {}  
 */
export const getCompetititonDetailApi=(data)=>{
	return	uni.$u.http.get('/capi-biz/yisai/competition/detail?id='+data.id,{
		 ...data
	})
	
}
/**
 *  赛事简介
 * @param {}  
 */
export const getCompetititonintroduceApi=(data)=>{
	return	uni.$u.http.get('/capi-biz/yisai/competition/introduce?id='+data.id,{
		 ...data
	})
	
}
/**
 *  赛事视频
 * @param {}  
 */
export const getCompetititonfileApi=(data)=>{
	return	uni.$u.http.post('/capi-biz/yisai/competition/file/list',{
		 ...data
	})
	
}
/**
 *  赛事修改
 * @param {}  
 */
export const getCompetititonUpdateApi=(data)=>{
	return	uni.$u.http.post('/capi-biz/yisai/competition/update',{
		 ...data
	})
	
}
/**
 *  首页banner
 * @param {}  
 */
export const getBannerListApi=(data)=>{
	return	uni.$u.http.get('/capi-biz/yisai/competition/banner',{
		 ...data
	})
	
}
// 机构
/**
 *  机构修改
 * @param {}  
 */
export const getInstitutionUpdateApi=(data)=>{
	return	uni.$u.http.post('/capi-biz/yisai/institution/update',{
		 ...data
	})
	
}
/**
 * 机构申请
 * @param {}  
 */
export const getInstitutionApplyApi=(data)=>{
	return	uni.$u.http.post('/capi-biz/yisai/institution/apply',{
		 ...data
	})
	
}
/**
 *  用户机构所在列表
 * @param {}  
 */
export const getUserinstitutionListApi=(data)=>{
	return	uni.$u.http.post('/capi-biz/yisai/user/institution/list',{
		 ...data
	})
	
}
/**
 *  机构详情
 * @param {}  
 */
export const getInstitutionDetailApi=(data)=>{
	return	uni.$u.http.post('/capi-biz/yisai/institution/detail',{
		 ...data
	})
	
}
/**
 *  机构列表
 * @param {}  
 */
export const getInstitutionListApi=(data)=>{
	return	uni.$u.http.post('/capi-biz/yisai/institution/list',{
		 ...data
	})
	
}
//节目
/**
 *  新增节目
 * @param {}  
 */
export const getInstitutionProgramSaveApi=(data)=>{
	return	uni.$u.http.post('/capi-biz/yisai/institutionProgram/save',{
		 ...data
	})
	
}

/**
 *  
 * @param {string} data 节目列表
 */
export const getInstitutionProgramListApi=(data)=>{
	return	uni.$u.http.get('/capi-biz/yisai/institutionProgram/list?competitionId=' +data.competitionId + '&institutionId=' + data.institutionId,{
		 ...data
	})
	
}
/**
 *  节目进程
 * @param {string} data 节目进程
 */
export const getInstitutionProgramProcessApi=(data)=>{
	return	uni.$u.http.get('/capi-biz/yisai/institutionProgram/process?competitionId=' +data.competitionId,{
		 ...data
	})
	
}
/**
 *  capi-biz/yisai/competitionPlayer/list
 * @param {string} data 节目修改
 */
export const getInstitutionProgramUpdateApi=(data)=>{
	return	uni.$u.http.post('/capi-biz/yisai/institutionProgram/update',{
		 ...data
	})
	
}
// 选手


/**
 *  
 * @param {string} data 选手列表
 */
export const getCompetitionPlayerListApi=(data)=>{
	return	uni.$u.http.post('/capi-biz/yisai/competitionPlayer/list',{
		 ...data
	})
	
}
/**
 *  
 * @param {string} data 节目进程选手列表
 */
export const getProgramqueryPlayerV2Api=(data)=>{
	return	uni.$u.http.post('/capi-biz/yisai/institutionProgram/queryPlayerV2',{
		 ...data
	})
	
}
/**
 *  
 * @param {string} data 选手修改
 */
export const getCompetitionPlayereditApi=(data)=>{
	return	uni.$u.http.post('/capi-biz/yisai/competitionPlayer/edit',{
		 ...data
	})
	
}

/**
 *  
 * @param {string} data 选手投票
 */
export const getCompetitionPlayerVoteApi=(data)=>{
	return	uni.$u.http.post('/capi-biz/yisai/competitionPlayer/vote',{
		 ...data
	})
	
}
/**
 *  /capi-biz/yisai/refuelGift/all
 * @param {string} data 选手详情
 */
export const getCompetitionPlayerDetailApi=(data)=>{
	return	uni.$u.http.post('/capi-biz/yisai/competitionPlayer/detail',{
		 ...data
	})
	
}
/**
 *  
 * @param {string} data 选手详情入场券
 */
export const getCompetitionPlayerentranceCouponsApi=(data)=>{
	return	uni.$u.http.get('/capi-biz/yisai/competitionPlayer/entranceCoupons?competitionId='+data.id,{
		 ...data
	})
	
}
//助力
/**
 *  
 * @param {string} data 助力礼物
 */
export const getrefuelGiftApi=(data)=>{
	let Id = data.playerId || ''
	return	uni.$u.http.get('/capi-biz/yisai/refuelGift/all?playerId='+Id)
	
}

/**
 *  选手投票列表
 * @param {string} data 
 */
export const getvoteListApi=(data)=>{
	return	uni.$u.http.post('/capi-biz/yisai/competitionPlayer/voteList',data)
	
}







